<?php
/**
 * User: jewens
 */
class Ticket extends MY_Api_Controller
{
    public function buy()
    {
        $uid = $this->uid;
        $aid = (int)$this->input->get_post('aid');
        $pay_password = $this->input->get_post('pay_password');

        $this->load->service('direct_seeding/service_direct_seeding_ticket');
        $data = $this->service_direct_seeding_ticket->buy($uid, $aid, $pay_password);

        $this->json_output($data['data'], $data['status']);
    }
    
    public function lists()
    {
    	$uid   = $this->uid;
        $page  = (int)$this->input->get_post('page');
        $limit = (int)$this->input->get_post('limit');
    
    	$this->load->service('direct_seeding/service_direct_seeding_ticket');
    	$data = $this->service_direct_seeding_ticket->lists($uid, $page, $limit);
    
    	$this->json_output($data['data'], $data['status']);
    }
    
    public function refund()
    {
    	$uid = $this->uid;
    	$tid = (int)$this->input->get_post('tid');
    
    	$this->load->service('direct_seeding/service_direct_seeding_ticket');
    	$data = $this->service_direct_seeding_ticket->refund($uid, $tid);
    
    	$this->json_output($data['data'], $data['status']);
    }
}